package com.bw.ppjokeplay.mvvm.viewmodel.find

import com.blankj.utilcode.util.LogUtils
import com.bw.ppjokeplay.adapter.CommentsAdapter
import com.bw.ppjokeplay.adapter.FindConcernAdapter
import com.bw.ppjokeplay.commen.entity.BaseEntity
import com.bw.ppjokeplay.commen.mvvm.viewmodel.BaseViewModel
import com.bw.ppjokeplay.mvvm.model.entity.CommentsEntity
import com.bw.ppjokeplay.mvvm.model.entity.TagEntity
import com.bw.ppjokeplay.mvvm.model.find.FindConcernModel
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * @author Lishaohe
 * @description:
 * @date :2021/11/13 0013 上午 8:36
 *
 */
class FindConcernViewModel : BaseViewModel<FindConcernModel>() {

    var offset:Int=0
    var pageCount:Int=10
    var tagId:Int=1
    var tagType:String="onlyfollow"
    var userId:Int=1
    var Adapter : FindConcernAdapter = FindConcernAdapter()
    override fun initdata() {
        requestgz()
    }

    fun requestgz(){
        m.requestsofaList(offset, pageCount, tagId, tagType, userId)!!
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(this)
    }

    override fun result(t: BaseEntity) {
        if (t is TagEntity){
            val tagEntity = t as TagEntity
            LogUtils.e(tagEntity.data!!.data)
            Adapter.setNewInstance(tagEntity.data!!.data)
        }
    }
}